//
//  InputView.m
//  sellHouse
//
//  Created by 李 佳伟 on 2018/11/26.
//  Copyright © 2018年 李 佳伟. All rights reserved.
//

#import "InputView.h"
#import "JTCSM.h"

static NSString *codeStr = @"获取验证码";
static CGFloat changespace = 10;
static CGFloat touchviewHeight = 30;
@implementation InputView

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/
- (id)initWithFrame:(CGRect)frame placeholder:(NSString *)placeholder isshow_touch:(BOOL)is_show{
    
    if (self == [super initWithFrame:frame]) {
        
        CGRect rect = [df labelHeightWithContent:codeStr height:frame.size.height font:15];
        
        self.textfield = [UITextField initWithframe:CGRectMake(0, 0, frame.size.width-rect.size.width-Kspace-changespace, frame.size.height) backgrandColor:nil placeholder:placeholder textAlignment:NSTextAlignmentLeft font:15 texcolor:RGBACOLOR(51, 51, 51, 1)];
        [self addSubview:self.textfield];
        
        if (is_show) {
            self.touchview = [UILabel initWithFrame:CGRectMake(KVIEW_X(self.textfield)+Kspace, (frame.size.height-touchviewHeight)/2, rect.size.width+changespace, touchviewHeight) text:codeStr font:15 textAlignment:NSTextAlignmentCenter texcolor:RGBACOLOR(153, 153, 153, 1) backgroundColor:nil];
            [df layerWithView:self.touchview radius:3 width:1 color:RGBACOLOR(241, 241, 241, 1)];
             [self addSubview:self.touchview];
            self.touchview.userInteractionEnabled = YES;
        }
        self.userInteractionEnabled = YES;
        [df lineViewWithHeightofTop:frame.size.height superView:self spacing:0 color:RGBACOLOR(241, 241, 241, 1) lineHeight:1];
        
    }
    return  self;
}

@end
